package com.example.mvvmtest.utils;

import android.app.Activity;
import android.os.Handler;
import android.os.Message;

import com.example.mvvmtest.test.TestMain;

import java.lang.ref.WeakReference;

public class HandlerUtil {

    public static class StaticHandler<T extends Activity> extends Handler{
        private WeakReference<T> mActivity;

        public StaticHandler(T mActivity) {
            this.mActivity = new WeakReference<>(mActivity);
        }

        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            LogUtil.e(mActivity.getClass().getPackage() + "-----" + msg.what);
        }
    }
}
